#include "stdafx.h"
#include "Format.h"

using namespace System;

String Format::convert(const MemoryBuffer& mem)
{
	String result;
    size_t origsize = mem.size();
    size_t convertedChars = 0;
    wchar_t* wcstring = new wchar_t[mem.size()];
	memset(wcstring, 0, mem.size() * sizeof(wchar_t));
    mbstowcs_s(&convertedChars, wcstring, mem.size(), (const char*)mem.getData(), _TRUNCATE);
	
	return result;
}

MemoryBuffer  Format::convert(const String& mem)
{
	MemoryBuffer result;
	result.updateSize(mem.size());
	for (size_t i = 0; i < result.size(); ++i)
	{
		result[i] = mem.c_str()[i] & 0xFF;
	}
	return result;
}